var t = getApp();

Page({
    data: {
        language: "",
        payAmount: "",
        rewardAmount: "",
        clockNum: 0,
        recordDetailShow: !1,
        recordDetail: [],
        total_page: 0,
        share_title: "",
        share_icon: "",
        isLoadMore: !0,
        page: 1
    },
    onLoad: function(t) {
        this._getMyRecord(), this._getMyRecordDetail(), this._getShareData();
    },
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onShow: function() {
        wx.showShareMenu({
            withShareTicket: !1,
            menus: [ "shareAppMessage", "shareTimeline" ]
        });
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreDetail() : console.log("没有更多数据");
    },
    onShareTimeline: function() {
        return {
            title: this.data.share_title,
            imageUrl: this.data.share_icon
        };
    },
    onShareAppMessage: function() {
        return {
            title: this.data.share_title,
            imageUrl: this.data.share_icon
        };
    },
    _getMyRecord: function() {
        var a = this, e = t.getNetAddresss("plugin.clock-in.api.clock-in-member.statistic");
        t._getNetWork({
            url: e,
            success: function(t) {
                var e = t.data;
                1 == e.result && a.setData({
                    payAmount: e.data.pay_amount,
                    rewardAmount: e.data.reward_amount,
                    clockNum: e.data.colck_num
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    _getMyRecordDetail: function() {
        var a = this, e = t.getNetAddresss("plugin.clock-in.api.clock-in-member.get-clock-list");
        t._getNetWork({
            url: e,
            success: function(e) {
                var o = e.data;
                1 == o.result && (t._isTextEmpty(o.data.data) || a.setData({
                    recordDetailShow: !0,
                    recordDetail: o.data.data,
                    total_page: o.data.total
                }));
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    _getShareData: function() {
        var a = this, e = t.getNetAddresss("plugin.clock-in.api.clock-in.get-set");
        t._getNetWork({
            url: e,
            success: function(t) {
                var e = t.data;
                1 == e.result && a.setData({
                    share_title: e.data.share.share_title,
                    share_icon: e.data.share.share_icon
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    _getMoreDetail: function() {
        if (this.data.page != this.data.total_page && !(this.data.page >= this.data.total_page)) {
            a.setData({
                page: this.data.page + 1
            });
            var a = this, e = t.getNetAddresss("plugin.clock-in.api.clock-in-member.get-clock-list");
            e += "&page=" + a.data.page, t._getNetWork({
                url: e,
                success: function(t) {
                    var e = t.data;
                    1 == e.result ? a.setData({
                        recordDetail: a.data.recordDetail.concat(e.data.data)
                    }) : a.setData({
                        page: a.data.page - 1,
                        isLoadMore: !1
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }
    }
});